# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php83-pecl-uv
_extname=uv
pkgver=0.3.0
pkgrel=0
pkgdesc="PHP 8.3 extension provides access to underlying libuv functions - PECL"
url="https://pecl.php.net/package/uv"
arch="all"
license="PHP-3.01"
_phpv=83
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev libuv-dev"
checkdepends="$_php-cgi"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	# https://github.com/amphp/ext-uv/issues/108
	rm -f tests/200-ares_getaddrinfo.phpt \
		tests/800-uv_tty.phpt \
		tests/005-uv_listen_cb-not-destroyed.phpt
	[ "$CARCH" = "ppc64le" ] && rm -f tests/999-uv_resident_set_memory.phpt
	$_php -d extension="$builddir"/modules/$_extname.so --ri $_extname
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	mkdir -p $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
f428ee2b75d82f5b841ab11bc388e8ea3552fd110ce278d8950ace74b2a932958b7698446fa13c46ec70a73bd3a29b9fe5035131174580d2c7d0e112fe771940  php-pecl-uv-0.3.0.tgz
"
